using System.Net.Sockets;
using Unity.VisualScripting;
using GameFramework.Network;
using NetworkMissHeartBeatEventArgs = UnityGameFramework.Runtime.NetworkMissHeartBeatEventArgs;

namespace LS.UGFUnits
{
    [UnitShortTitle("Network")]
    [UnitSurtitle("Miss Heart Beat")]
    public sealed class NetworkMissHeartBeat : FrameworkEventUnit<NetworkMissHeartBeatEventArgs>
    {
        protected override int EventId => NetworkMissHeartBeatEventArgs.EventId;
        protected override string HookName => UGFHookNames.NetworkMissHeartBeat;

        [DoNotSerialize]
        [PortLabelHidden]
        public ValueOutput NetworkChannel
        {
            get;
            private set;
        }

        [DoNotSerialize]
        [PortLabelHidden]
        public ValueOutput MissCount
        {
            get;
            private set;
        }
        
        protected override void Definition()
        {
            base.Definition();
            NetworkChannel = ValueOutput<INetworkChannel>(nameof(NetworkChannel));
            MissCount = ValueOutput<int>(nameof(MissCount));
        }

        protected override void AssignArguments(Flow flow, NetworkMissHeartBeatEventArgs args)
        {
            base.AssignArguments(flow, args);
            flow.SetValue(NetworkChannel, args.NetworkChannel);
            flow.SetValue(MissCount, args.MissCount);
        }
    }
}